#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <memory.h>
#include <assert.h>

void addbinary(char* a, char* b)
{
	int end1 = (int)strlen(a);
	int end2 = (int)strlen(b);
	int* tmp = malloc(sizeof(char) * (end1 + end2));
	int end = end1 + end2-1;
	assert(tmp);
	memset(tmp,0, end+1);
	while (end>=0)
	{
		if (a[end1] && b[end2])
		{
			tmp[end--] += 0;
			tmp[end - 1] = 0;
			tmp[end - 1] += 1;
			
		}
		else if (a[end1] || b[end2])
		{
			tmp[end--] += 1;
		}
		else
		{
			tmp[end--] += 0;
		}
	}

	
}

int main()
{
	char a[] = "11";
	char b[] = "01";
	addbinary(a, b);
	return 0;
}